window.addEventListener("message", function (e) {
    const kidFrame = document.getElementById('kidFrame');
    kidFrame.style.height = e.data + "px";
}, false);

function getModule0MarginTop() {
    const kidFrame = document.getElementById('kidFrame');
    const navHeight = document.getElementById("nav-main").clientHeight;
    kidFrame.setAttribute('style', 'margin-top:' + (navHeight) + 'px');
}

window.onresize = getModule0MarginTop;
window.onload = getModule0MarginTop;
function loadingMskBlock(){
    let msk = document.querySelector('.loading-msk');
    msk.setAttribute('style', 'display: block;');

}
function loadingMskNone(){
    let msk = document.querySelector('.loading-msk');
    msk.setAttribute('style', 'display: none;');
}
function overflowHidden() {
    document.body.setAttribute("style", "overflow:hidden");
}

function overflowAuto() {
    document.body.setAttribute("style", "overflow:auto");
}

let index_nav_li_index = 0;

function controlJumpto(i, t) {
    let index_nav_li = document.querySelectorAll('.index-nav-li');
    index_nav_li[index_nav_li_index].classList.remove('text-secondary');
    index_nav_li[index_nav_li_index].classList.add('text-white');
    index_nav_li[i].classList.remove('text-white');
    index_nav_li[i].classList.add('text-secondary');
    index_nav_li_index = i;
    let pageUrl = ['home', 'list', 'playlist'];
    let kidFrame = document.getElementById('kidFrame');
    let width = document.documentElement.clientWidth;
    if (width < 1024) {
        pageUrl[1] = pageUrl[1] + '_m';
    }
    kidFrame.style.height = "0px";
    kidFrame.src = '/' + pageUrl[i] + t;
}

function jumpto(url) {
    let kidFrame = document.getElementById('kidFrame');
    kidFrame.style.height = "0px";
    kidFrame.src = url;
}
let startTime = 0;
function playMusic() {
    let music_bar = document.getElementById('music-progress-bar');
    let timeTask = setInterval(function () {
        music_bar.setAttribute('style','width:'+startTime+'%')
        startTime=startTime+0.1;
        if (startTime>100){
            clearInterval(timeTask);
        }
    },100);
}

